/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: user
 * Date: 2023-10-29
 * Time: 20:09
 */
public class Test {

    public static int add(int a,int b) {
        return a+b;
    }

    public static int add(int a,int b,int c) {
        return a+b+c;
    }

    public static long add(long a,long b,long c) {
        return a+b+c;
    }

    public static double add(double d,double c) {
        return d+c;
    }

    public static long add(int a,long b) {
        return a+b;
    }

    public static long add(long a,int b) {
        return a+b;
    }

    public static void main(String[] args) {
        int x = 10;
        int y = 20;
        int ret = add(x,y);
        System.out.println(ret);

        double d1 = 10.5;
        double d2 = 12.5;
        double dd = add(d1,d2);
        System.out.println(dd);




    }

    public static void swap(int a,int b) {
        int tmp = a;
        a = b;
        b = tmp;
    }

    public static void main20(String[] args) {
        int x = 10;
        int y = 20;
        swap(x,y);
        System.out.println(x);
        System.out.println(y);
    }

    /**
     * 求n的阶乘
     * @param n
     * @return
     */
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }

    /**
     * 求阶乘和
     * @param n
     * @return
     */
    public static int facSum(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum += fac(i);
        }
        return sum;
    }

    public static int facSub(int n) {
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            sum -= fac(i);
        }
        return sum;
    }

    public static void main19(String[] args) {
        int ret = facSum(5);
        System.out.println(ret);
    }

    public static void main18(String[] args) {
        int x = 1;
        int y = 2;
        int ret = add(x,y);
        System.out.println(ret);
    }




    public static void fun(int a,int b) {
        System.out.println(a*b);
    }


    /*
        public static 返回值 方法名 (形式参数列表) {
            方法体，方法的具体实现内容;
        }
     */

    public static boolean isLeapYear(int year) {
        if((0 == year % 4 && 0 != year % 100) || 0 == year % 400){
            System.out.println(year+"年是闰年");
            return true;
        }else {
            System.out.println(year + "年不是闰年");
            return false;
        }
    }


    public static void main17(String[] args) {
        int n = 7;
        for (int i = 30; i >= 0; i -= 2) {
            System.out.print(((n >> i) & 1)+" ");
        }
        System.out.println();
        for (int i = 31; i >= 1; i -= 2) {
            System.out.print(((n >> i) & 1)+" ");
        }
    }

    public static void main16(String[] args) {
        /*int n = 7;
        int count = 0;
        while (n != 0) {
            count++;
            n = n & (n-1);
        }
        System.out.println(count);*/

        /*
        缺点 至少得移动32次
        int n = 7;
        int count = 0;
        for (int i = 0; i < 31; i++) {
            if(((n >> i) & 1) != 0) {
                count++;
            }
        }
        System.out.println(count);
        */

        int n = -1;
        int count = 0;
        while (n != 0) {
            if((n & 1) != 0) {
                count++;
            }
            n = n >>> 1;
        }
        System.out.println(count);
    }


    public static void main15(String[] args) {
        for (int i = 1; i < 999999; i++) {
            int count = 0;
            int tmp = i;
            while (tmp != 0) {
                count++;
                tmp /= 10;
            }
            //i --> 0
            tmp = i; // tmp = 153
            int sum = 0;
            while (tmp != 0) {
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if(i == sum) {
                System.out.println(i);
            }
        }
    }
    public static void main14(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = a % b;
        while (c != 0) {
            a = b;
            b = c;
            c = a % b;
        }
        System.out.println(b);
    }

    public static void main13(String[] args) {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(j+"*"+i+"="+(i*j)+" ");
            }
            System.out.println();
        }
    }
    public static void main12(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int age = scanner.nextInt();
        if(age <= 18) {

        }else if(age >= 19 && age <= 28) {

        }
    }

    public static void main11(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //系统生成一个随机数
        Random random = new Random();
        int randNum = random.nextInt(100);//[0-100)
        while (true) {
            System.out.println("请输入你要猜的数字：");
            int num = scanner.nextInt();
            if(num < randNum) {
                System.out.println("猜小了！");
            }else if(num > randNum) {
                System.out.println("猜大了!");
            }else {
                System.out.println("猜对了！");
                break;
            }
        }
    }

    public static void main10(String[] args) {
        Scanner scanner = new Scanner(System.in);

       /* while (scanner.hasNextInt()) {
            int a = scanner.nextInt();
            System.out.println(a);
        }*/

        while (scanner.hasNextLine()) {
            String name = scanner.nextLine();
            System.out.println(name);
        }
    }

    public static void main9(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        //String name = scanner.nextLine();//读取一行
        String name = scanner.next();//遇到空格会结束
        System.out.println(name);

        System.out.println("请输入年龄：");
        int age = scanner.nextInt();
        System.out.println(age);

        System.out.println("请输入你的体重：");
        float g = scanner.nextFloat();
        System.out.println(g);

        scanner.close();//关闭资源
    }

    public static void main8(String[] args) {
        System.out.println("输出且换行");
        System.out.print("输出不换行");
        System.out.printf("%s\n","格式化输出！");
    }

    public static void main7(String[] args) {
        int i = 0;
        do {
            System.out.println(i);
            i++;
        }while (i != 0);
    }

    public static void main6(String[] args) {
        /*for(int i = 1;i <= 10;i++) {
            System.out.print(i+" ");
        }
        System.out.println();*/

        /*for (int i = 0; i < 10; i++) {
            System.out.print(i+" ");
        }
        System.out.println();*/

        //n!
        /*int n = 5;
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        System.out.println(ret);*/

        // 1!+2!+.....+n! .  shift + f6

        int sum = 0;
        for (int n = 1; n <= 5; n++) {
            int ret = 1;
            for (int i = 1; i <= n; i++) {
                ret *= i;
            }
            sum += ret;
        }
        System.out.println(sum);


    }

    public static void main5(String[] args) {
        //写一个代码  找到1-100之间 既能被3整除
        // 也能被5整除的所有数字 要求  使用break 或者 continue中的一个
        int i = 1;
        while (i <= 100) {
            if(i % 15 != 0) {
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }

    public static void main4(String[] args) {
        int i = 1;
        while (i <= 10) {
            if(i == 3) {
                //结束本趟循环,去执行 下一趟
                i++;
                continue;
            }
            System.out.println(i);
            i++;
        }
    }

    public static void main3(String[] args) {
        int i = 1;
        int count = 0;
        while (i <= 100) {
            if(i / 10 == 9) {
                count++;
            }else if(i % 10 == 9) {
                count++;
            }
            i++;
        }
        System.out.println(count);
    }
    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();
        int k = 0;
        while (k < x) {
            int i = 2;
            while (i <= Math.sqrt(k)) {
                if(k % i == 0) {
                    //break;
                    System.out.println(k+" 不是素数！");
                    return;
                }
                i++;
            }
            //
            System.out.println(k+" 是素数！");
            k++;
        }

    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = scanner.nextInt();

        int i = 2;
        while (i <= Math.sqrt(x)) {
            if(x % i == 0) {
                //break;
                System.out.println(x+" 不是素数！");
                return;
            }
            i++;
        }
        //
        System.out.println(x+" 是素数！");
    }
}
